// 货架增删改查
const ShelvesController = require("../controllers/shelves");
const DeliveryController = require("../controllers/delivery");
const StationController = require("../controllers/station");
module.exports = app => {
    // 货架增删改查
    app.get("/admin/role/shelves", ShelvesController.GetShelves)
    app.get("/admin/role/shelves/:id", ShelvesController.GetShelve)
    app.post("/admin/role/shelves", ShelvesController.AddShelves)
    app.put("/admin/role/shelves/:id", ShelvesController.UpdateShelves)
    app.delete("/admin/role/shelves/:id", ShelvesController.DeleteShelves)
    // 查询货架下面的所有空快递
    app.get("/admin/role/shelves/:id/delivery", ShelvesController.GetShelveDeliveries)

    // 空快递增上改查
    app.get("/admin/role/delivery", DeliveryController.getAllDeliveries)
    app.get("/admin/role/delivery/:id", DeliveryController.getDelivery)
    app.post("/admin/role/delivery", DeliveryController.createDelivery)
    app.put("/admin/role/delivery/:id", DeliveryController.updateDelivery)
    app.delete("/admin/role/delivery/:id", DeliveryController.deleteDelivery)

    // 快递绑定空快递
    app.post("/admin/role/package/:id", DeliveryController.bindPackage)

    // 快递站的增删改查
    app.get("/admin/role/station", StationController.GetStations)
    app.get("/admin/role/station/:id", StationController.GetStation)
    app.post("/admin/role/station", StationController.AddStation)
    app.put("/admin/role/station/:id", StationController.UpdateStation)
    app.delete("/admin/role/station/:id", StationController.DeleteStation)

    // 查询空快递下对应包裹
    app.get("/admin/role/delivery/:id/package", DeliveryController.getDeliveryPackages)

    // 快递站头像上传
    app.post("/admin/role/station/avatar/", StationController.UploadAvatar)

    // 快递站头像删除
    app.post("/admin/role/station/delete/avatar/", StationController.DeleteAvatar)

    // 修改快递绑定
    app.put("/admin/role/package/:id", DeliveryController.updatePackage)


}